package com.woniuxy.spring.session.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * description: MyController <br>
 * date: 2022/1/6 9:46 上午 <br>
 * author: shesaifei <br>
 * version: 1.0 <br>
 */
@RestController
public class MyController {

    @Value("${server.port}")
    int port;

    @RequestMapping("/login")
    public String login(HttpSession session) {
        session.setAttribute("name", "zs");
        return "login:" + port + "----" + session.getAttribute("name");
    }

    @RequestMapping("/test")
    public String test(HttpSession session) {
        return "test:" + port + "----" + session.getAttribute("name");
    }
}
